﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Client
{
    public partial class FrmChat : Form
    {
        private string friend_name;
        private FrmMain frm;

        public FrmChat(string friend, FrmMain frm)
        {
            InitializeComponent();
            this.friend_name = friend;
            this.frm = frm;
        }

        private void FrmChat_Load(object sender, EventArgs e)
        {
            lblFriend.Text = friend_name;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Lib.Client c = Lib.Client.GetInstance();
            c.SendMessage(friend_name, txtMessage.Text);
            c.ReceiveOk();
        }

        public void AppendMessage(string str)
        {
            richTextBox1.Text = richTextBox1.Text + "\r\n" + str;
        }
    }
}
